Namespacing everything to /UVa.
[andmenj-acm.git] / UVa / 11040 - Add bricks in the wall / 11040.cpp
blob71fecae8074c867ac625b86c0bd5e40518f4ff28
1 #include <iostream>
3 using namespace std;
5 int a[9][9];
7 //Construye un triangulito de tres pisos que tiene la cima en el bloque (i,j).
8 void f(int i, int j){
9 int A = a[i][j], B = a[i+2][j], C = a[i+2][j+2];
11 a[i+1][j] = (A+B-C)/2; //X
12 a[i+1][j+1] = (A-B+C)/2; //Y
13 a[i+2][j+1] = (A-B-C)/2; //Z
16 int main(){
17 int C;
18 cin >> C;
19 while (C--){
20 for (int i=0; i<5; ++i){
21 for (int j=0; j<=i; ++j){
22 cin >> a[2*i][2*j];
25 for (int i=0; i<4; ++i){
26 for (int j=0; j<=i; ++j){
27 f(2*i, 2*j);
31 for (int i=0; i<9; ++i){
32 for (int j=0; j<=i; ++j){
33 cout << (j>0?" ":"") << a[i][j];
35 cout << endl;
38 return 0;